<nav-bar-panel></nav-bar-panel>
<div class="content container">
    <div ng-show="currentPage==='list'">
        <div>
            <tabset>
                <tab heading="商户分类"
                     ng-if="hasAnyRoles('admin', 'show_owner')">
                    <button class="btn btn-default btn-sm" ng-click="toAddCategory()">添加商户分类</button>
                    <div class="list-group">
                        <a href="#/shop-admin/category/{{category.id}}" class="list-group-item"
                           ng-repeat="category in shopCategories">
                            <img src="{{category.logoUrl}}" ng-if="category.logoUrl" style="width: 2em; height: 2em"/>
                            {{category.name}}</a>
                    </div>
                </tab>
                <tab heading="我的商户"
                     ng-if="hasAnyRoles('admin', 'show_owner')">
                    <a href="#/shop-admin/create_shop/create" class="btn btn-default">添加商户</a>

                    <div class="list-group">
                        <a href="#/shop-admin/shop/{{shop.id}}"
                           class="list-group-item"
                           ng-repeat="shop in myShops">
                            {{shop.name}}
                        </a>
                    </div>
                </tab>
                <tab heading="待审核商户"
                     ng-if="hasAnyRoles('admin', 'shop_checker')">
                    <div class="list-group">
                        <div class="list-group-item" ng-repeat="shopChange in shopChanges">
                            <span>{{shopChange.shop.name}}</span> <span>申请变更为:</span>

                            <div>
                                名称变为{{shopChange.name}}
                                <br/>
                                描述变为 <span ng-bind-html="shopChange.description | to_trusted"></span>
                                <br/>
                                图标变为 <img src="{{shopChange.logoUrl}}" style="width: 50px; height: 50px"/>
                                <br/>
                                分类变为 {{shopChange.category.name}}
                                <br/>
                                联系方式变为 {{shopChange.contact}}
                                <br/>
                                地址变为{{shopChange.address}}
                                <br/>
                                折扣变为{{shopChange.discount}}
                            </div>
                            <div>
                                <button class="btn btn-primary btn-sm" ng-click="agreeShopChange(shopChange)">同意
                                </button>
                                <button class="btn btn-danger btn-sm" ng-click="disagreeShopChange(shopChange)">拒绝
                                </button>
                            </div>
                        </div>
                    </div>
                </tab>
                <tab heading="待审核商品"
                     ng-if="hasAnyRoles('admin', 'product_checker')">
                    <div class="list-group">
                        <div class="list-group-item" ng-repeat="productChange in productChanges">
                            <span>{{productChange.product.name}}</span> <span>申请变更为:</span>

                            <div>
                                名称变为{{productChange.name}}
                                <br/>
                                描述变为
                                <p ng-bind-html="productChange.description | to_trusted"></p>
                                <br/>
                                图标变为 <img src="{{productChange.logoUrl}}" style="width: 50px; height: 50px"/>
                                <br/>
                                价格变为 {{productChange.price}}元
                                <br/>
                                折扣变为{{productChange.discount}}
                            </div>
                            <div>
                                <button class="btn btn-primary btn-sm" ng-click="agreeProductChange(productChange)">同意
                                </button>
                                <button class="btn btn-danger btn-sm" ng-click="disagreeProductChange(productChange)">拒绝
                                </button>
                            </div>
                        </div>
                    </div>
                </tab>
                <tab heading="微信推送"
                     ng-if="hasAnyRoles('admin', 'push_admin')">
                    <a href="#/push-admin" class="btn btn-primary">微信推送管理</a>
                </tab>
                <tab heading="系统设置"
                     ng-if="hasAnyRoles('admin')">
                    <div class="panel panel-default">
                        <div class="panel-heading">首页背景图片</div>
                        <div class="panel-body">
                            <!--<img src="{{index_background_image}}" alt="" style="width: 600px; height: 400px"/>-->
                            <div ng-repeat="img in index_background_images track by $index">
                                <img ng-src="{{img}}" class="img-thumbnail" alt=""/>
                                <button class="btn btn-danger btn-xs" ng-click="index_background_images.remove(img);updateIndexBackgroundImagesConfig()">删除</button>
                            </div>
                            <upload-file-panel upload-button-name="上传新背景图片" on-uploaded="onUploadedIndexBackgroundColor"
                                               is-public="true"></upload-file-panel>
                        </div>
                    </div>
                    <div class="panel panel-default">
                        <div class="panel-heading">首页显示热门商店数量</div>
                        <div class="panel-body">
                            <input type="number" ng-model="index_hotest_shops_count"/>
                            <button class="btn btn-primary btn-sm"
                                    ng-click="saveConfig('index_hotest_shops_count', index_hotest_shops_count)">保存
                            </button>
                        </div>
                    </div>
                    <a href="#/help-phone-page-editor">咨询电话静态页面设置</a>
                    <hr/>
                    <a href="#/renew-about-page-editor">补办说明静态页面内容</a>
                    <hr/>
                    <a href="#/one-card-about-page-editor">一卡通介绍静态页面内容</a>
                </tab>
            </tabset>
        </div>
    </div>
    <div ng-show="currentPage==='create'">
        <h3>添加商户分类</h3>
        <button class="btn btn-default sm" ng-click="toShowCategories()">分类列表</button>
        <form class="form">
            <div class="form-group">
                <label class="col-sm-2 control-label">分类名称</label>
                <div class="col-sm-10">
                    <input type="text" class="form-control" placeholder="新分类名称" ng-model="newShopCategory.name">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">图标</label>

                <div class="col-sm-10">
                    <img ng-show="newShopCategory.logoUrl" ng-src="{{newShopCategory.logoUrl}}" style="width: 50px; height: 50px"/>
                    <upload-file-panel upload-button-name="上传图标" on-uploaded="onUploadedNewShopCategory" is-public="true"></upload-file-panel>
                </div>
            </div>
            <button type="submit" class="btn btn-default"
                    ng-click="saveShopCategory(newShopCategory);">确认
            </button>
        </form>
    </div>
</div>
<footer-bar-panel></footer-bar-panel>